#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(void){
	vector<int> cow;
	long long int height;
	int n,temp;
	cin>>n>>height;
	for(int i=0;i<n;i++){
		cin>>temp;
		cow.push_back(temp);
	}
	sort(cow.begin(),cow.end());
	for(int i=cow.size()-1;i>=0;i--){
		height-=cow[i];
		if(height<=0){
			cout<<cow.size()-i;
			return 0;
		}
	}
}